#!/bin/sh

# author:gaoxu
# description:tiktokdownloader auto pload

declare -r path="/Users/gaoxu/Downloads/douyin"

echo -e '启动抖音自动化发布\n'

# 进入脚本目录
cd /Users/gaoxu/personal_workspace/social-auto-upload

# 启动虚拟机环境
source /Users/gaoxu/personal_workspace/social-auto-upload/venv/bin/activate

# 定义用户名称的数组
user_name_list=(@11 @77)
file_video_list=(banyun_111_0 banyun_111_1)

# 获取数组长度
length_user=${#user_name_list[@]}
length_film=${#file_video_list[@]}

if [[ $length_user -eq $length_film ]]; then
    for ((i=0; i<${#user_name_list[@]}; i++)); do
        python cli_main.py douyin ${user_name_list[$i]} login
        python cli_main.py douyin ${user_name_list[$i]} upload "$path/${file_video_list[$i]}.mp4" -pt 0
    done
    echo -e '抖音视频发布成功\n'
else
    echo -e "账号和视频数量不对等,重新修改!\n"
fi